<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>settingstree.cpp 示例文件 | Qt Widgets 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-tools-settingseditor-example.html">Settings Editor Example</a></td><td >settingstree.cpp 示例文件</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">settingstree.cpp 示例文件</h1>
<span class="subtitle">tools/settingseditor/settingstree.cpp</span>
<!-- $$$tools/settingseditor/settingstree.cpp-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the examples of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  <span class="preprocessor">#include &lt;QtWidgets&gt;</span>

  <span class="preprocessor">#include &quot;settingstree.h&quot;</span>
  <span class="preprocessor">#include &quot;variantdelegate.h&quot;</span>

  SettingsTree<span class="operator">::</span>SettingsTree(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
      : <span class="type"><a href="qtreewidget.html">QTreeWidget</a></span>(parent)
      <span class="operator">,</span> autoRefresh(<span class="keyword">false</span>)
  {
      setItemDelegate(<span class="keyword">new</span> VariantDelegate(<span class="keyword">this</span>));

      <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> labels;
      labels <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">&quot;Setting&quot;</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">&quot;Type&quot;</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> tr(<span class="string">&quot;Value&quot;</span>);
      setHeaderLabels(labels);
      header()<span class="operator">-</span><span class="operator">&gt;</span>setSectionResizeMode(<span class="number">0</span><span class="operator">,</span> <span class="type"><a href="qheaderview.html">QHeaderView</a></span><span class="operator">::</span>ResizeToContents);
      header()<span class="operator">-</span><span class="operator">&gt;</span>setSectionResizeMode(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qheaderview.html">QHeaderView</a></span><span class="operator">::</span>ResizeToContents);
      header()<span class="operator">-</span><span class="operator">&gt;</span>setSectionResizeMode(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="qheaderview.html">QHeaderView</a></span><span class="operator">::</span>Stretch);

      refreshTimer<span class="operator">.</span>setInterval(<span class="number">2000</span>);

      groupIcon<span class="operator">.</span>addPixmap(style()<span class="operator">-</span><span class="operator">&gt;</span>standardPixmap(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>SP_DirClosedIcon)<span class="operator">,</span>
                          <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span><span class="operator">::</span>Normal<span class="operator">,</span> <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span><span class="operator">::</span>Off);
      groupIcon<span class="operator">.</span>addPixmap(style()<span class="operator">-</span><span class="operator">&gt;</span>standardPixmap(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>SP_DirOpenIcon)<span class="operator">,</span>
                          <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span><span class="operator">::</span>Normal<span class="operator">,</span> <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span><span class="operator">::</span>On);
      keyIcon<span class="operator">.</span>addPixmap(style()<span class="operator">-</span><span class="operator">&gt;</span>standardPixmap(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>SP_FileIcon));

      connect(<span class="operator">&amp;</span>refreshTimer<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="../qtcore/qtimer.html">QTimer</a></span><span class="operator">::</span>timeout<span class="operator">,</span> <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>SettingsTree<span class="operator">::</span>maybeRefresh);
  }

  SettingsTree<span class="operator">::</span><span class="operator">~</span>SettingsTree()
  {
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>setSettingsObject(<span class="keyword">const</span> SettingsPtr <span class="operator">&amp;</span>newSettings)
  {
      settings <span class="operator">=</span> newSettings;
      clear();

      <span class="keyword">if</span> (settings<span class="operator">.</span>isNull()) {
          refreshTimer<span class="operator">.</span>stop();
      } <span class="keyword">else</span> {
          refresh();
          <span class="keyword">if</span> (autoRefresh)
              refreshTimer<span class="operator">.</span>start();
      }
  }

  <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> SettingsTree<span class="operator">::</span>sizeHint() <span class="keyword">const</span>
  {
      <span class="keyword">const</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> availableGeometry <span class="operator">=</span> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>desktop()<span class="operator">-</span><span class="operator">&gt;</span>availableGeometry(<span class="keyword">this</span>);
      <span class="keyword">return</span> <span class="type"><a href="../qtcore/qsize.html">QSize</a></span>(availableGeometry<span class="operator">.</span>width() <span class="operator">*</span> <span class="number">2</span> <span class="operator">/</span> <span class="number">3</span><span class="operator">,</span> availableGeometry<span class="operator">.</span>height() <span class="operator">*</span> <span class="number">2</span> <span class="operator">/</span> <span class="number">3</span>);
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>setAutoRefresh(bool autoRefresh)
  {
      <span class="keyword">this</span><span class="operator">-</span><span class="operator">&gt;</span>autoRefresh <span class="operator">=</span> autoRefresh;
      <span class="keyword">if</span> (<span class="operator">!</span>settings<span class="operator">.</span>isNull()) {
          <span class="keyword">if</span> (autoRefresh) {
              maybeRefresh();
              refreshTimer<span class="operator">.</span>start();
          } <span class="keyword">else</span> {
              refreshTimer<span class="operator">.</span>stop();
          }
      }
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>setFallbacksEnabled(bool enabled)
  {
      <span class="keyword">if</span> (<span class="operator">!</span>settings<span class="operator">.</span>isNull()) {
          settings<span class="operator">-</span><span class="operator">&gt;</span>setFallbacksEnabled(enabled);
          refresh();
      }
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>maybeRefresh()
  {
      <span class="keyword">if</span> (state() <span class="operator">!</span><span class="operator">=</span> EditingState)
          refresh();
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>refresh()
  {
      <span class="keyword">if</span> (settings<span class="operator">.</span>isNull())
          <span class="keyword">return</span>;

      disconnect(<span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qtreewidget.html">QTreeWidget</a></span><span class="operator">::</span>itemChanged<span class="operator">,</span>
                 <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>SettingsTree<span class="operator">::</span>updateSetting);

      settings<span class="operator">-</span><span class="operator">&gt;</span>sync();
      updateChildItems(<span class="number">0</span>);

      connect(<span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qtreewidget.html">QTreeWidget</a></span><span class="operator">::</span>itemChanged<span class="operator">,</span>
              <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>SettingsTree<span class="operator">::</span>updateSetting);
  }

  bool SettingsTree<span class="operator">::</span>event(<span class="type"><a href="../qtcore/qevent.html">QEvent</a></span> <span class="operator">*</span>event)
  {
      <span class="keyword">if</span> (event<span class="operator">-</span><span class="operator">&gt;</span>type() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="../qtcore/qevent.html">QEvent</a></span><span class="operator">::</span>WindowActivate) {
          <span class="keyword">if</span> (isActiveWindow() <span class="operator">&amp;</span><span class="operator">&amp;</span> autoRefresh)
              maybeRefresh();
      }
      <span class="keyword">return</span> <span class="type"><a href="qtreewidget.html">QTreeWidget</a></span><span class="operator">::</span>event(event);
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>updateSetting(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>item)
  {
      <span class="type"><a href="../qtcore/qstring.html">QString</a></span> key <span class="operator">=</span> item<span class="operator">-</span><span class="operator">&gt;</span>text(<span class="number">0</span>);
      <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>ancestor <span class="operator">=</span> item<span class="operator">-</span><span class="operator">&gt;</span>parent();
      <span class="keyword">while</span> (ancestor) {
          key<span class="operator">.</span>prepend(ancestor<span class="operator">-</span><span class="operator">&gt;</span>text(<span class="number">0</span>) <span class="operator">+</span> QLatin1Char(<span class="char">'/'</span>));
          ancestor <span class="operator">=</span> ancestor<span class="operator">-</span><span class="operator">&gt;</span>parent();
      }

      settings<span class="operator">-</span><span class="operator">&gt;</span>setValue(key<span class="operator">,</span> item<span class="operator">-</span><span class="operator">&gt;</span>data(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>UserRole));
      <span class="keyword">if</span> (autoRefresh)
          refresh();
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>updateChildItems(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent)
  {
      <span class="type">int</span> dividerIndex <span class="operator">=</span> <span class="number">0</span>;

      foreach (<span class="type"><a href="../qtcore/qstring.html">QString</a></span> group<span class="operator">,</span> settings<span class="operator">-</span><span class="operator">&gt;</span>childGroups()) {
          <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>child;
          <span class="type">int</span> childIndex <span class="operator">=</span> findChild(parent<span class="operator">,</span> group<span class="operator">,</span> dividerIndex);
          <span class="keyword">if</span> (childIndex <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span>) {
              child <span class="operator">=</span> childAt(parent<span class="operator">,</span> childIndex);
              child<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span>());
              child<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span>());
              child<span class="operator">-</span><span class="operator">&gt;</span>setData(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>UserRole<span class="operator">,</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>());
              moveItemForward(parent<span class="operator">,</span> childIndex<span class="operator">,</span> dividerIndex);
          } <span class="keyword">else</span> {
              child <span class="operator">=</span> createItem(group<span class="operator">,</span> parent<span class="operator">,</span> dividerIndex);
          }
          child<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="number">0</span><span class="operator">,</span> groupIcon);
          <span class="operator">+</span><span class="operator">+</span>dividerIndex;

          settings<span class="operator">-</span><span class="operator">&gt;</span>beginGroup(group);
          updateChildItems(child);
          settings<span class="operator">-</span><span class="operator">&gt;</span>endGroup();
      }

      foreach (<span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>key<span class="operator">,</span> settings<span class="operator">-</span><span class="operator">&gt;</span>childKeys()) {
          <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>child;
          <span class="type">int</span> childIndex <span class="operator">=</span> findChild(parent<span class="operator">,</span> key<span class="operator">,</span> <span class="number">0</span>);

          <span class="keyword">if</span> (childIndex <span class="operator">=</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span> <span class="operator">|</span><span class="operator">|</span> childIndex <span class="operator">&gt;</span><span class="operator">=</span> dividerIndex) {
              <span class="keyword">if</span> (childIndex <span class="operator">!</span><span class="operator">=</span> <span class="operator">-</span><span class="number">1</span>) {
                  child <span class="operator">=</span> childAt(parent<span class="operator">,</span> childIndex);
                  <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> child<span class="operator">-</span><span class="operator">&gt;</span>childCount(); <span class="operator">+</span><span class="operator">+</span>i)
                      <span class="keyword">delete</span> childAt(child<span class="operator">,</span> i);
                  moveItemForward(parent<span class="operator">,</span> childIndex<span class="operator">,</span> dividerIndex);
              } <span class="keyword">else</span> {
                  child <span class="operator">=</span> createItem(key<span class="operator">,</span> parent<span class="operator">,</span> dividerIndex);
              }
              child<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="number">0</span><span class="operator">,</span> keyIcon);
              <span class="operator">+</span><span class="operator">+</span>dividerIndex;
          } <span class="keyword">else</span> {
              child <span class="operator">=</span> childAt(parent<span class="operator">,</span> childIndex);
          }

          <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> value <span class="operator">=</span> settings<span class="operator">-</span><span class="operator">&gt;</span>value(key);
          <span class="keyword">if</span> (value<span class="operator">.</span>type() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span><span class="operator">::</span>Invalid) {
              child<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">1</span><span class="operator">,</span> <span class="string">&quot;Invalid&quot;</span>);
          } <span class="keyword">else</span> {
              child<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">1</span><span class="operator">,</span> value<span class="operator">.</span>typeName());
          }
          child<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">2</span><span class="operator">,</span> VariantDelegate<span class="operator">::</span>displayText(value));
          child<span class="operator">-</span><span class="operator">&gt;</span>setData(<span class="number">2</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>UserRole<span class="operator">,</span> value);
      }

      <span class="keyword">while</span> (dividerIndex <span class="operator">&lt;</span> childCount(parent))
          <span class="keyword">delete</span> childAt(parent<span class="operator">,</span> dividerIndex);
  }

  <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>SettingsTree<span class="operator">::</span>createItem(<span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>text<span class="operator">,</span>
                                            <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="type">int</span> index)
  {
      <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>after <span class="operator">=</span> <span class="number">0</span>;
      <span class="keyword">if</span> (index <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>)
          after <span class="operator">=</span> childAt(parent<span class="operator">,</span> index <span class="operator">-</span> <span class="number">1</span>);

      <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>item;
      <span class="keyword">if</span> (parent)
          item <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span>(parent<span class="operator">,</span> after);
      <span class="keyword">else</span>
          item <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span>(<span class="keyword">this</span><span class="operator">,</span> after);

      item<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="number">0</span><span class="operator">,</span> text);
      item<span class="operator">-</span><span class="operator">&gt;</span>setFlags(item<span class="operator">-</span><span class="operator">&gt;</span>flags() <span class="operator">|</span> <span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>ItemIsEditable);
      <span class="keyword">return</span> item;
  }

  <span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>SettingsTree<span class="operator">::</span>childAt(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="type">int</span> index)
  {
      <span class="keyword">if</span> (parent)
          <span class="keyword">return</span> parent<span class="operator">-</span><span class="operator">&gt;</span>child(index);
      <span class="keyword">else</span>
          <span class="keyword">return</span> topLevelItem(index);
  }

  <span class="type">int</span> SettingsTree<span class="operator">::</span>childCount(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent)
  {
      <span class="keyword">if</span> (parent)
          <span class="keyword">return</span> parent<span class="operator">-</span><span class="operator">&gt;</span>childCount();
      <span class="keyword">else</span>
          <span class="keyword">return</span> topLevelItemCount();
  }

  <span class="type">int</span> SettingsTree<span class="operator">::</span>findChild(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="../qtcore/qstring.html">QString</a></span> <span class="operator">&amp;</span>text<span class="operator">,</span>
                              <span class="type">int</span> startIndex)
  {
      <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> startIndex; i <span class="operator">&lt;</span> childCount(parent); <span class="operator">+</span><span class="operator">+</span>i) {
          <span class="keyword">if</span> (childAt(parent<span class="operator">,</span> i)<span class="operator">-</span><span class="operator">&gt;</span>text(<span class="number">0</span>) <span class="operator">=</span><span class="operator">=</span> text)
              <span class="keyword">return</span> i;
      }
      <span class="keyword">return</span> <span class="operator">-</span><span class="number">1</span>;
  }

  <span class="type">void</span> SettingsTree<span class="operator">::</span>moveItemForward(<span class="type"><a href="qtreewidgetitem.html">QTreeWidgetItem</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="type">int</span> oldIndex<span class="operator">,</span>
                                     <span class="type">int</span> newIndex)
  {
      <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> oldIndex <span class="operator">-</span> newIndex; <span class="operator">+</span><span class="operator">+</span>i)
          <span class="keyword">delete</span> childAt(parent<span class="operator">,</span> newIndex);
  }

</pre>
</div>
<!-- @@@tools/settingseditor/settingstree.cpp -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
